<template>

    <el-container style="height: 100%; min-height: 100vh">
      <el-aside :width="sideWidth + 'px'" style="background-color: rgb(238, 241, 246);  min-height: 100vh;height: 100%">
        <Aside :isCollapse="isCollapse" :logoTextShow="logoTextShow"/>
      </el-aside>

      <el-container>
        <el-header style="  border-bottom: 1px solid #ccc; ">

          <Header  :collapseBtnClass="collapseBtnClass" :collapse="collapse"/>

        </el-header>

        <el-main>
<!--          表示当前页面的子路由会在router-view中展示-->
          <router-view/>
        </el-main>


      </el-container>
    </el-container>
</template>

<script>
//引入components
import Aside from "@/components/Aside";
import Header from "@/components/Header";

//使用utils中的request
import request from "@/utils/request";

export default {
  name: 'Home',
  data() {
    return {

      collapseBtnClass: 'el-icon-s-fold',
      //收缩控制
      isCollapse: false,
      sideWidth: 200,
      //收缩展开时控制logo文字
      logoTextShow: true,
    }
  },


  //此页面需要用到的组件
  components: {
    //侧边栏
    Aside,
    //头部弹窗
    Header
  },

  methods: {

    collapse(){ //点击收缩按钮出发
      this.isCollapse=!this.isCollapse
      if (this.isCollapse){
        this.sideWidth = 64
        this.collapseBtnClass='el-icon-s-unfold'
        this.logoTextShow = false
      }else{
        this.sideWidth = 200
        this.collapseBtnClass='el-icon-s-fold'
        this.logoTextShow=true
      }
    }

  }
}
</script>


